home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 June
/
EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso
/
earcd
/
utilsys
/
corrctnm.lha
/
CorrectName
/
CorrectName.mod
< prev
next >
Wrap
Text File
|
1995-10-06
|
2KB
|
78 lines
(*(*
*
* $Id: CorrectName.mod 37.4 1995/10/06 16:15:27 tig Exp tig $
*
* $Log: CorrectName.mod $
* Revision 37.4 1995/10/06 16:15:27 tig
* Error code (warn) will be returned only if the option "ShowErrors" is set!
*
* Revision 37.3 1995/10/04 05:46:32 tig
* The error msgs allways (!) won't be printed if SHOWERR isnt' used.
* If the commandline couldn't be parsed (by DOS) then the whole command-
* line will be returned!
*
* Revision 37.2 1995/10/02 05:30:14 tig
* - Added option "ERR=SHOWERROR/S".
* If set on startup error-msgs will be printed, else the old (the given)
* filename will be returned!
* - Added FP as an abbreviation for FILEPART.
*
* Revision 37.1 1995/10/01 14:23:46 tig
* First version.
*
*****************************************************************
*
* Usage: CorrectName FileName/A,FP=FilePart/S,Err=ShowErrors/S
*
* "FileName" must be used and specifies the filename.
* "FP=FilePart" is optional. If used, only the filename w/o path
* is printed else filename with full path!
* "Err=ShowErrors" is optional. If set on startup error-msgs will
* be printed, else the old (the given) filename will be returned!
*
*)*)
MODULE CorrectName;
IMPORT
y: SYSTEM, ol: OberonLib, d: Dos;
CONST
tmp = "FileName/A,FP=FilePart/S,Err=ShowErrors/S"
"\o$VER: CorrectName 37.4 (06.10.95) by Thomas Igracki";
VAR
RD : d.RDArgsPtr;
args : STRUCT (dummy: d.ArgsStruct)
fileName: d.ArgString;
filePart,
showErrs: d.ArgBool;
END;
lock : d.FileLockPtr;
buff : ARRAY 100 OF CHAR;
BEGIN
RD := d.ReadArgs (tmp,args,NIL);
IF RD # NIL THEN
lock := d.Lock (args.fileName^, d.sharedLock);
IF lock # NIL THEN
IF d.NameFromLock (lock, buff, SIZE(buff)) THEN
IF args.filePart = d.DOSTRUE THEN
d.PrintF (d.FilePart(buff)^)
ELSE
d.PrintF (buff)
END;
HALT(d.ok) (* *)
END;
END;
END;
HALT(d.warn)
CLOSE
IF ol.Result # 0 THEN
IF RD = NIL THEN args.fileName := ol.dosCmdBuf END;
IF args.showErrs = d.DOSTRUE THEN
y.SETREG(0,d.PrintFault(d.IoErr(),NIL))
ELSE
ol.Result := 0; d.PrintF (args.fileName^)
END
END;
IF lock # NIL THEN d.UnLock (lock) END;
IF RD # NIL THEN d.FreeArgs (RD) END;
END CorrectName.